<?php
/**
 * The template used to display attachments.
 *
 * @package dkret3
 * @since 3.6
 */

get_header() ?>

    <div id="container">

        <?php /* dkret3 Hook */ do_action( 'dkret_before_container' ); ?>    

        <div id="content" role="main">

            <?php /* dkret3 Hook */ do_action( 'dkret_before_content' ); ?>
            
            <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

                <div id="post-<?php the_ID() ?>" <?php post_class() ?>>

                    <?php /* dkret3 Hook */ do_action( 'dkret_before_entry' ); ?>

                    <div class="entry-content">
                        <div class="entry-attachment">

                            <?php if ( wp_attachment_is_image() ) : ?>

                                <p class="attachment-image">
                                    <a class="aligncenter" href="<?php echo wp_get_attachment_url( $post->ID ); ?>" title="<?php echo esc_html( get_the_title( $post->ID ), 1 ) ?>" rel="attachment"><?php echo wp_get_attachment_image( $post->ID, apply_filters( 'dkret_attachment_image_size', 'medium' ) ); ?></a>
                                    <div class="entry-caption wp-caption-text"><?php if ( ! empty( $post->post_excerpt ) ) the_excerpt(); // this is the "caption" ?></div>
                                </p>

                                <?php the_content( ''.__('Read More <span class="meta-nav">&raquo;</span>', 'dkret').'' ); ?>
                                
                                <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'dkret' ), 'after' => '</div>' ) ); ?>
                              
                                <div id="nav-below" class="navigation gallery-post">
                                    <div class="nav-previous"><?php previous_image_link(); ?></div>
                                    <div class="nav-next"><?php next_image_link(); ?></div>
                                </div><!-- #nav-below -->

                            <?php else : ?>

                                <p class="attachment">
                                    <a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a>
                                </p>
                                
                                <?php the_content( ''.__('Read More <span class="meta-nav">&raquo;</span>', 'dkret').'' ); ?>
                                
                                <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'dkret' ), 'after' => '</div>' ) ); ?>
                                
                            <?php endif; ?>

                        </div><!-- .entry-attachment -->

                    </div><!-- .entry-content -->

                    <?php /* dkret3 Hook */ do_action( 'dkret_after_entry' ); ?>

                </div><!-- #post-id -->

                <?php /* dkret3 Hook */ do_action( 'dkret_after_singular' ); ?>

                <?php comments_template() ?>

                <?php endwhile; ?>

            <?php else: ?>

                <p class="no-data">
                    <?php _e( 'Sorry, no attachments matched your criteria.', 'dkret' ); ?>
                </p><!-- .no-data -->

            <?php endif; ?>            
            
            <?php /* dkret3 Hook */ do_action( 'dkret_after_content' ); ?>

        </div><!-- #content -->

        <?php /* dkret3 Hook */ do_action( 'dkret_after_container' ); ?>

    </div><!-- #container -->

<?php get_sidebar() ?>
<?php get_footer() ?>